CC = gcc
CFLAGS = -Wall -g -DMAXLOGLEVEL=6
LDFLAGS = -ltss2-sys -ltss2-tctildr -ltss2-rc -lcrypto

TCTI_NAME := $(shell if [ -c /dev/tpm0 ] || [ -c /dev/tpmrm0 ]; then echo "tabrmd"; else echo "mssim"; fi)
CFLAGS += -DTCTI_NAME=\"$(TCTI_NAME)\"

all: hmac_auth.run

hmac_auth.run: *.c
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

run: hmac_auth.run
	export TSS2_LOG=all+info && ./hmac_auth.run

clean:
	rm -f hmac_auth.run
